package Client;

import java.io.*;
import java.net.*;
import java.util.Scanner;

public class JavaSocketClient {
	public static void main(String[] args) {
		try {
			int portNumber = 5555;
			Scanner input = new Scanner(System.in);
			String sendMessage;
			System.out.println("Strarting Java Socket Client ...");
			System.out.println("using at port" + portNumber + "...");

			do{
				Socket sock = new Socket("220.67.124.237", portNumber);
				
				System.out.print("client : ");
				sendMessage = input.next();
				
				
				ObjectOutputStream outstream = new ObjectOutputStream(sock.getOutputStream());
				outstream.writeObject(sendMessage);
				outstream.flush();
				
				ObjectInputStream instream = new ObjectInputStream(sock.getInputStream());
				System.out.println(instream.readObject());
				sock.close();
				
			}while(sendMessage != "finish");
			
		} catch (Exception ex) {
			ex.printStackTrace();
		}// try-catch end
	}// main end
}// class end